<?xml version='1.0' encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <link href="cpip.css" rel="stylesheet" type="text/css" />
    <title>File: /Users/paulross/dev/linux/linux-3.13/include/linux/preempt.h</title>
  </head>
  <body>
    <h1>File: /Users/paulross/dev/linux/linux-3.13/include/linux/preempt.h</h1>
    <p>Green shading in the line number column
means the source is part of the translation unit, red means it is conditionally excluded.
Highlighted line numbers link to the translation unit page. Highlighted macros link to
the macro page.</p>
    <pre><a name="1" /><span class="Maybe">       1:</span> <span class="f">#</span><span class="n">ifndef</span> <a href="cpu.c_macros_ref.html#_X19MSU5VWF9QUkVFTVBUX0hfMA__"><span class="b">__LINUX_PREEMPT_H</span></a>
<a name="2" /><span class="Maybe">       2:</span> <span class="f">#</span><span class="n">define</span> <a href="cpu.c_macros_ref.html#_X19MSU5VWF9QUkVFTVBUX0hfMA__"><span class="b">__LINUX_PREEMPT_H</span></a>
<a name="3" /><span class="Maybe">       3:</span> 
<a name="4" /><span class="Maybe">       4:</span> <span class="k">/*</span>
<a name="5" /><span class="Maybe">       5:</span> <span class="k"> * include/linux/preempt.h - macros for accessing and manipulating</span>
<a name="6" /><span class="Maybe">       6:</span> <span class="k"> * preempt_count (used for kernel preemption, interrupt count, etc.)</span>
<a name="7" /><span class="Maybe">       7:</span> <span class="k"> */</span>
<a name="8" /><span class="Maybe">       8:</span> 
<a name="9" /><span class="Maybe">       9:</span> <span class="f">#</span><span class="n">include</span> <span class="f">&lt;</span><span class="b">linux</span><span class="f">/</span><span class="b">linkage</span><span class="f">.</span><span class="b">h</span><span class="f">&gt;</span>
<a name="10" /><span class="Maybe">      10:</span> <span class="f">#</span><span class="n">include</span> <span class="f">&lt;</span><span class="b">linux</span><span class="f">/</span><span class="b">list</span><span class="f">.</span><span class="b">h</span><span class="f">&gt;</span>
<a name="11" /><span class="Maybe">      11:</span> 
<a name="12" /><span class="Maybe">      12:</span> <span class="k">/*</span>
<a name="13" /><span class="Maybe">      13:</span> <span class="k"> * We use the MSB mostly because its available; see &lt;linux/preempt_mask.h&gt; for</span>
<a name="14" /><span class="Maybe">      14:</span> <span class="k"> * the other bits -- can&apos;t include that header due to inclusion hell.</span>
<a name="15" /><span class="Maybe">      15:</span> <span class="k"> */</span>
<a name="16" /><span class="Maybe">      16:</span> <span class="f">#</span><span class="n">define</span> <a href="cpu.c_macros_ref.html#_UFJFRU1QVF9ORUVEX1JFU0NIRURfMA__"><span class="b">PREEMPT_NEED_RESCHED</span></a>    <span class="c">0x80000000</span>
<a name="17" /><span class="Maybe">      17:</span> 
<a name="18" /><span class="Maybe">      18:</span> <span class="f">#</span><span class="n">include</span> <span class="f">&lt;</span><span class="m">asm</span><span class="f">/</span><span class="b">preempt</span><span class="f">.</span><span class="b">h</span><span class="f">&gt;</span>
<a name="19" /><span class="Maybe">      19:</span> 
<a name="20" /><span class="False">      20:</span> <span class="f">#</span><span class="n">if</span> <span class="b">defined</span><span class="f">(</span><span class="b">CONFIG_DEBUG_PREEMPT</span><span class="f">)</span> <span class="f">||</span> <span class="b">defined</span><span class="f">(</span><span class="b">CONFIG_PREEMPT_TRACER</span><span class="f">)</span>
<a name="21" /><span class="False">      21:</span> <span class="m">extern</span> <span class="m">void</span> <a href="cpu.c_macros_noref.html#_cHJlZW1wdF9jb3VudF9hZGRfMA__"><span class="b">preempt_count_add</span></a><span class="f">(</span><span class="m">int</span> <span class="b">val</span><span class="f">)</span><span class="f">;</span>
<a name="22" /><span class="False">      22:</span> <span class="m">extern</span> <span class="m">void</span> <a href="cpu.c_macros_noref.html#_cHJlZW1wdF9jb3VudF9zdWJfMA__"><span class="b">preempt_count_sub</span></a><span class="f">(</span><span class="m">int</span> <span class="b">val</span><span class="f">)</span><span class="f">;</span>
<a name="23" /><span class="False">      23:</span> <span class="f">#</span><span class="n">define</span> <a href="cpu.c_macros_noref.html#_cHJlZW1wdF9jb3VudF9kZWNfYW5kX3Rlc3RfMA__"><span class="b">preempt_count_dec_and_test</span></a><span class="f">(</span><span class="f">)</span> <span class="f">(</span><span class="f">{</span> <a href="cpu.c_macros_noref.html#_cHJlZW1wdF9jb3VudF9zdWJfMA__"><span class="b">preempt_count_sub</span></a><span class="f">(</span><span class="c">1</span><span class="f">)</span><span class="f">;</span> <span class="b">should_resched</span><span class="f">(</span><span class="f">)</span><span class="f">;</span> <span class="f">}</span><span class="f">)</span>
<a name="24" /><span class="Maybe">      24:</span> <span class="f">#</span><span class="n">else</span>
<a name="25" /><span class="Maybe">      25:</span> <span class="f">#</span><span class="n">define</span> <a href="cpu.c_macros_noref.html#_cHJlZW1wdF9jb3VudF9hZGRfMA__"><span class="b">preempt_count_add</span></a><span class="f">(</span><span class="b">val</span><span class="f">)</span>    <span class="b">__preempt_count_add</span><span class="f">(</span><span class="b">val</span><span class="f">)</span>
<a name="26" /><span class="Maybe">      26:</span> <span class="f">#</span><span class="n">define</span> <a href="cpu.c_macros_noref.html#_cHJlZW1wdF9jb3VudF9zdWJfMA__"><span class="b">preempt_count_sub</span></a><span class="f">(</span><span class="b">val</span><span class="f">)</span>    <span class="b">__preempt_count_sub</span><span class="f">(</span><span class="b">val</span><span class="f">)</span>
<a name="27" /><span class="Maybe">      27:</span> <span class="f">#</span><span class="n">define</span> <a href="cpu.c_macros_noref.html#_cHJlZW1wdF9jb3VudF9kZWNfYW5kX3Rlc3RfMA__"><span class="b">preempt_count_dec_and_test</span></a><span class="f">(</span><span class="f">)</span> <span class="b">__preempt_count_dec_and_test</span><span class="f">(</span><span class="f">)</span>
<a name="28" /><span class="Maybe">      28:</span> <span class="f">#</span><span class="n">endif</span>
<a name="29" /><span class="Maybe">      29:</span> 
<a name="30" /><span class="Maybe">      30:</span> <span class="f">#</span><span class="n">define</span> <a href="cpu.c_macros_noref.html#_X19wcmVlbXB0X2NvdW50X2luY18w"><span class="b">__preempt_count_inc</span></a><span class="f">(</span><span class="f">)</span> <span class="b">__preempt_count_add</span><span class="f">(</span><span class="c">1</span><span class="f">)</span>
<a name="31" /><span class="Maybe">      31:</span> <span class="f">#</span><span class="n">define</span> <a href="cpu.c_macros_noref.html#_X19wcmVlbXB0X2NvdW50X2RlY18w"><span class="b">__preempt_count_dec</span></a><span class="f">(</span><span class="f">)</span> <span class="b">__preempt_count_sub</span><span class="f">(</span><span class="c">1</span><span class="f">)</span>
<a name="32" /><span class="Maybe">      32:</span> 
<a name="33" /><span class="Maybe">      33:</span> <span class="f">#</span><span class="n">define</span> <a href="cpu.c_macros_noref.html#_cHJlZW1wdF9jb3VudF9pbmNfMA__"><span class="b">preempt_count_inc</span></a><span class="f">(</span><span class="f">)</span> <a href="cpu.c_macros_noref.html#_cHJlZW1wdF9jb3VudF9hZGRfMA__"><span class="b">preempt_count_add</span></a><span class="f">(</span><span class="c">1</span><span class="f">)</span>
<a name="34" /><span class="Maybe">      34:</span> <span class="f">#</span><span class="n">define</span> <a href="cpu.c_macros_noref.html#_cHJlZW1wdF9jb3VudF9kZWNfMA__"><span class="b">preempt_count_dec</span></a><span class="f">(</span><span class="f">)</span> <a href="cpu.c_macros_noref.html#_cHJlZW1wdF9jb3VudF9zdWJfMA__"><span class="b">preempt_count_sub</span></a><span class="f">(</span><span class="c">1</span><span class="f">)</span>
<a name="35" /><span class="Maybe">      35:</span> 
<a name="36" /><span class="False">      36:</span> <span class="f">#</span><span class="n">ifdef</span> <span class="b">CONFIG_PREEMPT_COUNT</span>
<a name="37" /><span class="False">      37:</span> 
<a name="38" /><span class="False">      38:</span> <span class="f">#</span><span class="n">define</span> <a href="cpu.c_macros_ref.html#_cHJlZW1wdF9kaXNhYmxlXzA_"><span class="b">preempt_disable</span></a><span class="f">(</span><span class="f">)</span> \
<a name="39" /><span class="False">      39:</span> <span class="m">do</span> <span class="f">{</span> \
<a name="40" /><span class="False">      40:</span>     <a href="cpu.c_macros_noref.html#_cHJlZW1wdF9jb3VudF9pbmNfMA__"><span class="b">preempt_count_inc</span></a><span class="f">(</span><span class="f">)</span><span class="f">;</span> \
<a name="41" /><span class="False">      41:</span>     <a href="cpu.c_macros_ref.html#_YmFycmllcl8w"><span class="b">barrier</span></a><span class="f">(</span><span class="f">)</span><span class="f">;</span> \
<a name="42" /><span class="False">      42:</span> <span class="f">}</span> <span class="m">while</span> <span class="f">(</span><span class="c">0</span><span class="f">)</span>
<a name="43" /><span class="False">      43:</span> 
<a name="44" /><span class="False">      44:</span> <span class="f">#</span><span class="n">define</span> <a href="cpu.c_macros_noref.html#_c2NoZWRfcHJlZW1wdF9lbmFibGVfbm9fcmVzY2hlZF8w"><span class="b">sched_preempt_enable_no_resched</span></a><span class="f">(</span><span class="f">)</span> \
<a name="45" /><span class="False">      45:</span> <span class="m">do</span> <span class="f">{</span> \
<a name="46" /><span class="False">      46:</span>     <a href="cpu.c_macros_ref.html#_YmFycmllcl8w"><span class="b">barrier</span></a><span class="f">(</span><span class="f">)</span><span class="f">;</span> \
<a name="47" /><span class="False">      47:</span>     <a href="cpu.c_macros_noref.html#_cHJlZW1wdF9jb3VudF9kZWNfMA__"><span class="b">preempt_count_dec</span></a><span class="f">(</span><span class="f">)</span><span class="f">;</span> \
<a name="48" /><span class="False">      48:</span> <span class="f">}</span> <span class="m">while</span> <span class="f">(</span><span class="c">0</span><span class="f">)</span>
<a name="49" /><span class="False">      49:</span> 
<a name="50" /><span class="False">      50:</span> <span class="f">#</span><span class="n">define</span> <a href="cpu.c_macros_ref.html#_cHJlZW1wdF9lbmFibGVfbm9fcmVzY2hlZF8w"><span class="b">preempt_enable_no_resched</span></a><span class="f">(</span><span class="f">)</span> <a href="cpu.c_macros_noref.html#_c2NoZWRfcHJlZW1wdF9lbmFibGVfbm9fcmVzY2hlZF8w"><span class="b">sched_preempt_enable_no_resched</span></a><span class="f">(</span><span class="f">)</span>
<a name="51" /><span class="False">      51:</span> 
<a name="52" /><span class="False">      52:</span> <span class="f">#</span><span class="n">ifdef</span> <span class="b">CONFIG_PREEMPT</span>
<a name="53" /><span class="False">      53:</span> <span class="f">#</span><span class="n">define</span> <a href="cpu.c_macros_ref.html#_cHJlZW1wdF9lbmFibGVfMA__"><span class="b">preempt_enable</span></a><span class="f">(</span><span class="f">)</span> \
<a name="54" /><span class="False">      54:</span> <span class="m">do</span> <span class="f">{</span> \
<a name="55" /><span class="False">      55:</span>     <a href="cpu.c_macros_ref.html#_YmFycmllcl8w"><span class="b">barrier</span></a><span class="f">(</span><span class="f">)</span><span class="f">;</span> \
<a name="56" /><span class="False">      56:</span>     <span class="m">if</span> <span class="f">(</span><a href="cpu.c_macros_ref.html#_dW5saWtlbHlfMA__"><span class="b">unlikely</span></a><span class="f">(</span><a href="cpu.c_macros_noref.html#_cHJlZW1wdF9jb3VudF9kZWNfYW5kX3Rlc3RfMA__"><span class="b">preempt_count_dec_and_test</span></a><span class="f">(</span><span class="f">)</span><span class="f">)</span><span class="f">)</span> \
<a name="57" /><span class="False">      57:</span>         <span class="b">__preempt_schedule</span><span class="f">(</span><span class="f">)</span><span class="f">;</span> \
<a name="58" /><span class="False">      58:</span> <span class="f">}</span> <span class="m">while</span> <span class="f">(</span><span class="c">0</span><span class="f">)</span>
<a name="59" /><span class="False">      59:</span> 
<a name="60" /><span class="False">      60:</span> <span class="f">#</span><span class="n">define</span> <a href="cpu.c_macros_noref.html#_cHJlZW1wdF9jaGVja19yZXNjaGVkXzA_"><span class="b">preempt_check_resched</span></a><span class="f">(</span><span class="f">)</span> \
<a name="61" /><span class="False">      61:</span> <span class="m">do</span> <span class="f">{</span> \
<a name="62" /><span class="False">      62:</span>     <span class="m">if</span> <span class="f">(</span><span class="b">should_resched</span><span class="f">(</span><span class="f">)</span><span class="f">)</span> \
<a name="63" /><span class="False">      63:</span>         <span class="b">__preempt_schedule</span><span class="f">(</span><span class="f">)</span><span class="f">;</span> \
<a name="64" /><span class="False">      64:</span> <span class="f">}</span> <span class="m">while</span> <span class="f">(</span><span class="c">0</span><span class="f">)</span>
<a name="65" /><span class="False">      65:</span> 
<a name="66" /><span class="False">      66:</span> <span class="f">#</span><span class="n">else</span>
<a name="67" /><span class="False">      67:</span> <span class="f">#</span><span class="n">define</span> <a href="cpu.c_macros_ref.html#_cHJlZW1wdF9lbmFibGVfMA__"><span class="b">preempt_enable</span></a><span class="f">(</span><span class="f">)</span> <a href="cpu.c_macros_ref.html#_cHJlZW1wdF9lbmFibGVfbm9fcmVzY2hlZF8w"><span class="b">preempt_enable_no_resched</span></a><span class="f">(</span><span class="f">)</span>
<a name="68" /><span class="False">      68:</span> <span class="f">#</span><span class="n">define</span> <a href="cpu.c_macros_noref.html#_cHJlZW1wdF9jaGVja19yZXNjaGVkXzA_"><span class="b">preempt_check_resched</span></a><span class="f">(</span><span class="f">)</span> <span class="m">do</span> <span class="f">{</span> <span class="f">}</span> <span class="m">while</span> <span class="f">(</span><span class="c">0</span><span class="f">)</span>
<a name="69" /><span class="False">      69:</span> <span class="f">#</span><span class="n">endif</span>
<a name="70" /><span class="False">      70:</span> 
<a name="71" /><span class="False">      71:</span> <span class="f">#</span><span class="n">define</span> <a href="cpu.c_macros_ref.html#_cHJlZW1wdF9kaXNhYmxlX25vdHJhY2VfMA__"><span class="b">preempt_disable_notrace</span></a><span class="f">(</span><span class="f">)</span> \
<a name="72" /><span class="False">      72:</span> <span class="m">do</span> <span class="f">{</span> \
<a name="73" /><span class="False">      73:</span>     <a href="cpu.c_macros_noref.html#_X19wcmVlbXB0X2NvdW50X2luY18w"><span class="b">__preempt_count_inc</span></a><span class="f">(</span><span class="f">)</span><span class="f">;</span> \
<a name="74" /><span class="False">      74:</span>     <a href="cpu.c_macros_ref.html#_YmFycmllcl8w"><span class="b">barrier</span></a><span class="f">(</span><span class="f">)</span><span class="f">;</span> \
<a name="75" /><span class="False">      75:</span> <span class="f">}</span> <span class="m">while</span> <span class="f">(</span><span class="c">0</span><span class="f">)</span>
<a name="76" /><span class="False">      76:</span> 
<a name="77" /><span class="False">      77:</span> <span class="f">#</span><span class="n">define</span> <a href="cpu.c_macros_noref.html#_cHJlZW1wdF9lbmFibGVfbm9fcmVzY2hlZF9ub3RyYWNlXzA_"><span class="b">preempt_enable_no_resched_notrace</span></a><span class="f">(</span><span class="f">)</span> \
<a name="78" /><span class="False">      78:</span> <span class="m">do</span> <span class="f">{</span> \
<a name="79" /><span class="False">      79:</span>     <a href="cpu.c_macros_ref.html#_YmFycmllcl8w"><span class="b">barrier</span></a><span class="f">(</span><span class="f">)</span><span class="f">;</span> \
<a name="80" /><span class="False">      80:</span>     <a href="cpu.c_macros_noref.html#_X19wcmVlbXB0X2NvdW50X2RlY18w"><span class="b">__preempt_count_dec</span></a><span class="f">(</span><span class="f">)</span><span class="f">;</span> \
<a name="81" /><span class="False">      81:</span> <span class="f">}</span> <span class="m">while</span> <span class="f">(</span><span class="c">0</span><span class="f">)</span>
<a name="82" /><span class="False">      82:</span> 
<a name="83" /><span class="False">      83:</span> <span class="f">#</span><span class="n">ifdef</span> <span class="b">CONFIG_PREEMPT</span>
<a name="84" /><span class="False">      84:</span> 
<a name="85" /><span class="False">      85:</span> <span class="f">#</span><span class="n">ifndef</span> <span class="b">CONFIG_CONTEXT_TRACKING</span>
<a name="86" /><span class="False">      86:</span> <span class="f">#</span><span class="n">define</span> <span class="b">__preempt_schedule_context</span><span class="f">(</span><span class="f">)</span> <span class="b">__preempt_schedule</span><span class="f">(</span><span class="f">)</span>
<a name="87" /><span class="False">      87:</span> <span class="f">#</span><span class="n">endif</span>
<a name="88" /><span class="False">      88:</span> 
<a name="89" /><span class="False">      89:</span> <span class="f">#</span><span class="n">define</span> <a href="cpu.c_macros_ref.html#_cHJlZW1wdF9lbmFibGVfbm90cmFjZV8w"><span class="b">preempt_enable_notrace</span></a><span class="f">(</span><span class="f">)</span> \
<a name="90" /><span class="False">      90:</span> <span class="m">do</span> <span class="f">{</span> \
<a name="91" /><span class="False">      91:</span>     <a href="cpu.c_macros_ref.html#_YmFycmllcl8w"><span class="b">barrier</span></a><span class="f">(</span><span class="f">)</span><span class="f">;</span> \
<a name="92" /><span class="False">      92:</span>     <span class="m">if</span> <span class="f">(</span><a href="cpu.c_macros_ref.html#_dW5saWtlbHlfMA__"><span class="b">unlikely</span></a><span class="f">(</span><span class="b">__preempt_count_dec_and_test</span><span class="f">(</span><span class="f">)</span><span class="f">)</span><span class="f">)</span> \
<a name="93" /><span class="False">      93:</span>         <span class="b">__preempt_schedule_context</span><span class="f">(</span><span class="f">)</span><span class="f">;</span> \
<a name="94" /><span class="False">      94:</span> <span class="f">}</span> <span class="m">while</span> <span class="f">(</span><span class="c">0</span><span class="f">)</span>
<a name="95" /><span class="False">      95:</span> <span class="f">#</span><span class="n">else</span>
<a name="96" /><span class="False">      96:</span> <span class="f">#</span><span class="n">define</span> <a href="cpu.c_macros_ref.html#_cHJlZW1wdF9lbmFibGVfbm90cmFjZV8w"><span class="b">preempt_enable_notrace</span></a><span class="f">(</span><span class="f">)</span> <a href="cpu.c_macros_noref.html#_cHJlZW1wdF9lbmFibGVfbm9fcmVzY2hlZF9ub3RyYWNlXzA_"><span class="b">preempt_enable_no_resched_notrace</span></a><span class="f">(</span><span class="f">)</span>
<a name="97" /><span class="False">      97:</span> <span class="f">#</span><span class="n">endif</span>
<a name="98" /><span class="False">      98:</span> 
<a name="99" /><span class="Maybe">      99:</span> <span class="f">#</span><span class="n">else</span> <span class="k">/* !CONFIG_PREEMPT_COUNT */</span>
<a name="100" /><span class="Maybe">     100:</span> 
<a name="101" /><span class="Maybe">     101:</span> <span class="k">/*</span>
<a name="102" /><span class="Maybe">     102:</span> <span class="k"> * Even if we don&apos;t have any preemption, we need preempt disable/enable</span>
<a name="103" /><span class="Maybe">     103:</span> <span class="k"> * to be barriers, so that we don&apos;t have things like get_user/put_user</span>
<a name="104" /><span class="Maybe">     104:</span> <span class="k"> * that can cause faults and scheduling migrate into our preempt-protected</span>
<a name="105" /><span class="Maybe">     105:</span> <span class="k"> * region.</span>
<a name="106" /><span class="Maybe">     106:</span> <span class="k"> */</span>
<a name="107" /><span class="Maybe">     107:</span> <span class="f">#</span><span class="n">define</span> <a href="cpu.c_macros_ref.html#_cHJlZW1wdF9kaXNhYmxlXzA_"><span class="b">preempt_disable</span></a><span class="f">(</span><span class="f">)</span>            <a href="cpu.c_macros_ref.html#_YmFycmllcl8w"><span class="b">barrier</span></a><span class="f">(</span><span class="f">)</span>
<a name="108" /><span class="Maybe">     108:</span> <span class="f">#</span><span class="n">define</span> <a href="cpu.c_macros_noref.html#_c2NoZWRfcHJlZW1wdF9lbmFibGVfbm9fcmVzY2hlZF8w"><span class="b">sched_preempt_enable_no_resched</span></a><span class="f">(</span><span class="f">)</span>    <a href="cpu.c_macros_ref.html#_YmFycmllcl8w"><span class="b">barrier</span></a><span class="f">(</span><span class="f">)</span>
<a name="109" /><span class="Maybe">     109:</span> <span class="f">#</span><span class="n">define</span> <a href="cpu.c_macros_ref.html#_cHJlZW1wdF9lbmFibGVfbm9fcmVzY2hlZF8w"><span class="b">preempt_enable_no_resched</span></a><span class="f">(</span><span class="f">)</span>        <a href="cpu.c_macros_ref.html#_YmFycmllcl8w"><span class="b">barrier</span></a><span class="f">(</span><span class="f">)</span>
<a name="110" /><span class="Maybe">     110:</span> <span class="f">#</span><span class="n">define</span> <a href="cpu.c_macros_ref.html#_cHJlZW1wdF9lbmFibGVfMA__"><span class="b">preempt_enable</span></a><span class="f">(</span><span class="f">)</span>            <a href="cpu.c_macros_ref.html#_YmFycmllcl8w"><span class="b">barrier</span></a><span class="f">(</span><span class="f">)</span>
<a name="111" /><span class="Maybe">     111:</span> <span class="f">#</span><span class="n">define</span> <a href="cpu.c_macros_noref.html#_cHJlZW1wdF9jaGVja19yZXNjaGVkXzA_"><span class="b">preempt_check_resched</span></a><span class="f">(</span><span class="f">)</span>            <span class="m">do</span> <span class="f">{</span> <span class="f">}</span> <span class="m">while</span> <span class="f">(</span><span class="c">0</span><span class="f">)</span>
<a name="112" /><span class="Maybe">     112:</span> 
<a name="113" /><span class="Maybe">     113:</span> <span class="f">#</span><span class="n">define</span> <a href="cpu.c_macros_ref.html#_cHJlZW1wdF9kaXNhYmxlX25vdHJhY2VfMA__"><span class="b">preempt_disable_notrace</span></a><span class="f">(</span><span class="f">)</span>        <a href="cpu.c_macros_ref.html#_YmFycmllcl8w"><span class="b">barrier</span></a><span class="f">(</span><span class="f">)</span>
<a name="114" /><span class="Maybe">     114:</span> <span class="f">#</span><span class="n">define</span> <a href="cpu.c_macros_noref.html#_cHJlZW1wdF9lbmFibGVfbm9fcmVzY2hlZF9ub3RyYWNlXzA_"><span class="b">preempt_enable_no_resched_notrace</span></a><span class="f">(</span><span class="f">)</span>    <a href="cpu.c_macros_ref.html#_YmFycmllcl8w"><span class="b">barrier</span></a><span class="f">(</span><span class="f">)</span>
<a name="115" /><span class="Maybe">     115:</span> <span class="f">#</span><span class="n">define</span> <a href="cpu.c_macros_ref.html#_cHJlZW1wdF9lbmFibGVfbm90cmFjZV8w"><span class="b">preempt_enable_notrace</span></a><span class="f">(</span><span class="f">)</span>        <a href="cpu.c_macros_ref.html#_YmFycmllcl8w"><span class="b">barrier</span></a><span class="f">(</span><span class="f">)</span>
<a name="116" /><span class="Maybe">     116:</span> 
<a name="117" /><span class="Maybe">     117:</span> <span class="f">#</span><span class="n">endif</span> <span class="k">/* CONFIG_PREEMPT_COUNT */</span>
<a name="118" /><span class="Maybe">     118:</span> 
<a name="119" /><span class="Maybe">     119:</span> <span class="f">#</span><span class="n">ifdef</span> <a href="cpu.c_macros_ref.html#_Q09ORklHX1BSRUVNUFRfTk9USUZJRVJTXzA_"><span class="b">CONFIG_PREEMPT_NOTIFIERS</span></a>
<a name="120" /><span class="Maybe">     120:</span> 
<a name="121" /><span class="Maybe">     121:</span> <span class="m">struct</span> <span class="b">preempt_notifier</span><span class="f">;</span>
<a name="122" /><span class="Maybe">     122:</span> 
<a name="123" /><span class="Maybe">     123:</span> <span class="k">/**</span>
<a name="124" /><span class="Maybe">     124:</span> <span class="k"> * preempt_ops - notifiers called when a task is preempted and rescheduled</span>
<a name="125" /><span class="Maybe">     125:</span> <span class="k"> * @sched_in: we&apos;re about to be rescheduled:</span>
<a name="126" /><span class="Maybe">     126:</span> <span class="k"> *    notifier: struct preempt_notifier for the task being scheduled</span>
<a name="127" /><span class="Maybe">     127:</span> <span class="k"> *    cpu:  cpu we&apos;re scheduled on</span>
<a name="128" /><span class="Maybe">     128:</span> <span class="k"> * @sched_out: we&apos;ve just been preempted</span>
<a name="129" /><span class="Maybe">     129:</span> <span class="k"> *    notifier: struct preempt_notifier for the task being preempted</span>
<a name="130" /><span class="Maybe">     130:</span> <span class="k"> *    next: the task that&apos;s kicking us out</span>
<a name="131" /><span class="Maybe">     131:</span> <span class="k"> *</span>
<a name="132" /><span class="Maybe">     132:</span> <span class="k"> * Please note that sched_in and out are called under different</span>
<a name="133" /><span class="Maybe">     133:</span> <span class="k"> * contexts.  sched_out is called with rq lock held and irq disabled</span>
<a name="134" /><span class="Maybe">     134:</span> <span class="k"> * while sched_in is called without rq lock and irq enabled.  This</span>
<a name="135" /><span class="Maybe">     135:</span> <span class="k"> * difference is intentional and depended upon by its users.</span>
<a name="136" /><span class="Maybe">     136:</span> <span class="k"> */</span>
<a name="137" /><span class="Maybe">     137:</span> <span class="m">struct</span> <span class="b">preempt_ops</span> <span class="f">{</span>
<a name="138" /><span class="Maybe">     138:</span>     <span class="m">void</span> <span class="f">(</span><span class="f">*</span><span class="b">sched_in</span><span class="f">)</span><span class="f">(</span><span class="m">struct</span> <span class="b">preempt_notifier</span> <span class="f">*</span><span class="b">notifier</span><span class="f">,</span> <span class="m">int</span> <span class="b">cpu</span><span class="f">)</span><span class="f">;</span>
<a name="139" /><span class="Maybe">     139:</span>     <span class="m">void</span> <span class="f">(</span><span class="f">*</span><span class="b">sched_out</span><span class="f">)</span><span class="f">(</span><span class="m">struct</span> <span class="b">preempt_notifier</span> <span class="f">*</span><span class="b">notifier</span><span class="f">,</span>
<a name="140" /><span class="Maybe">     140:</span>               <span class="m">struct</span> <span class="b">task_struct</span> <span class="f">*</span><span class="b">next</span><span class="f">)</span><span class="f">;</span>
<a name="141" /><span class="Maybe">     141:</span> <span class="f">}</span><span class="f">;</span>
<a name="142" /><span class="Maybe">     142:</span> 
<a name="143" /><span class="Maybe">     143:</span> <span class="k">/**</span>
<a name="144" /><span class="Maybe">     144:</span> <span class="k"> * preempt_notifier - key for installing preemption notifiers</span>
<a name="145" /><span class="Maybe">     145:</span> <span class="k"> * @link: internal use</span>
<a name="146" /><span class="Maybe">     146:</span> <span class="k"> * @ops: defines the notifier functions to be called</span>
<a name="147" /><span class="Maybe">     147:</span> <span class="k"> *</span>
<a name="148" /><span class="Maybe">     148:</span> <span class="k"> * Usually used in conjunction with container_of().</span>
<a name="149" /><span class="Maybe">     149:</span> <span class="k"> */</span>
<a name="150" /><span class="Maybe">     150:</span> <span class="m">struct</span> <span class="b">preempt_notifier</span> <span class="f">{</span>
<a name="151" /><span class="Maybe">     151:</span>     <span class="m">struct</span> <span class="b">hlist_node</span> <span class="b">link</span><span class="f">;</span>
<a name="152" /><span class="Maybe">     152:</span>     <span class="m">struct</span> <span class="b">preempt_ops</span> <span class="f">*</span><span class="b">ops</span><span class="f">;</span>
<a name="153" /><span class="Maybe">     153:</span> <span class="f">}</span><span class="f">;</span>
<a name="154" /><span class="Maybe">     154:</span> 
<a name="155" /><span class="Maybe">     155:</span> <span class="m">void</span> <span class="b">preempt_notifier_register</span><span class="f">(</span><span class="m">struct</span> <span class="b">preempt_notifier</span> <span class="f">*</span><span class="b">notifier</span><span class="f">)</span><span class="f">;</span>
<a name="156" /><span class="Maybe">     156:</span> <span class="m">void</span> <span class="b">preempt_notifier_unregister</span><span class="f">(</span><span class="m">struct</span> <span class="b">preempt_notifier</span> <span class="f">*</span><span class="b">notifier</span><span class="f">)</span><span class="f">;</span>
<a name="157" /><span class="Maybe">     157:</span> 
<a name="158" /><span class="Maybe">     158:</span> <span class="m">static</span> <span class="m">inline</span> <span class="m">void</span> <span class="b">preempt_notifier_init</span><span class="f">(</span><span class="m">struct</span> <span class="b">preempt_notifier</span> <span class="f">*</span><span class="b">notifier</span><span class="f">,</span>
<a name="159" /><span class="Maybe">     159:</span>                      <span class="m">struct</span> <span class="b">preempt_ops</span> <span class="f">*</span><span class="b">ops</span><span class="f">)</span>
<a name="160" /><span class="Maybe">     160:</span> <span class="f">{</span>
<a name="161" /><span class="Maybe">     161:</span>     <span class="b">INIT_HLIST_NODE</span><span class="f">(</span><span class="f">&amp;</span><span class="b">notifier</span><span class="f">-&gt;</span><span class="b">link</span><span class="f">)</span><span class="f">;</span>
<a name="162" /><span class="Maybe">     162:</span>     <span class="b">notifier</span><span class="f">-&gt;</span><span class="b">ops</span> <span class="f">=</span> <span class="b">ops</span><span class="f">;</span>
<a name="163" /><span class="Maybe">     163:</span> <span class="f">}</span>
<a name="164" /><span class="Maybe">     164:</span> 
<a name="165" /><span class="Maybe">     165:</span> <span class="f">#</span><span class="n">endif</span>
<a name="166" /><span class="Maybe">     166:</span> 
<a name="167" /><span class="True">     167:</span> <span class="f">#</span><span class="n">endif</span> <span class="k">/* __LINUX_PREEMPT_H */</span>
<a name="168" /><span class="True">     168:</span> </pre>
  </body>
</html>
